#ifndef _TASKQUEUE_H
#define _TASKQUEUE_H
#include <queue>
#include "task.hpp"
#include "MutexLock.hpp"
#include "Condition.hpp"
#include "Nocopyable.hpp"
#include <memory>
using std::shared_ptr;
using std::queue;

class TaskQueue:public Nocopyable
{
public:
    TaskQueue(int capacity):_capacity(capacity) {}
    ~TaskQueue() {}


    shared_ptr<task> pop();
    void push(task*);
    bool full();
    bool empty();
    int size();
    void wake();


private:

    MutexLock _mutex;
    Condition _notempty;
    Condition _notfull;
    int _capacity;
    queue<shared_ptr<task>> task_queue;


};
#endif

